﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    [Serializable]
    [DataContract] 
    public class BianZhiJieYongModel
    {
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }

        private int _BianZhiID;
        [DataMember]
        public int BianZhiID
        {
            get { return _BianZhiID; }
            set { _BianZhiID = value; }
        }

        private string _JieYongID;
        [DataMember]
        public string JieYongID
        {
            get { return _JieYongID; }
            set { _JieYongID = value; }
        }

        private string _JieYongQingKuang;
        [DataMember]
        public string JieYongQingKuang
        {
            get { return _JieYongQingKuang; }
            set { _JieYongQingKuang = value; }
        }

        private string _JieYongType;
        [DataMember]
        public string JieYongType
        {
            get { return _JieYongType; }
            set { _JieYongType = value; }
        }

        private string _BianZhiGUID;
        [DataMember]
        public string BianZhiGUID
        {
            get { return _BianZhiGUID; }
            set { _BianZhiGUID = value; }
        }
        private bool _IsTongKeShiJieYong;
        [DataMember]
        public bool IsZhengKeTongKeShiJieYong
        {
            get { return _IsTongKeShiJieYong; }
            set { _IsTongKeShiJieYong = value; }
        }
        private string _IsTongKeShiJieYongS;
        [DataMember]
        public string IsZhengKeTongKeShiJieYongS
        {
            get { return _IsTongKeShiJieYongS; }
            set { _IsTongKeShiJieYongS = value; }
        }
        private bool _IsGuoDuXing;
        [DataMember]
        public bool IsGuoDuXing
        {
            get { return _IsGuoDuXing; }
            set { _IsGuoDuXing = value; }
        }
        private string _GuoDuZhiShu;
        [DataMember]
        public string GuoDuZhiShu
        {
            get { return _GuoDuZhiShu; }
            set { _GuoDuZhiShu = value; }
        }
        private bool _IsFenPei;
        [DataMember]
        public bool IsFenPei
        {
            get { return _IsFenPei; }
            set { _IsFenPei = value; }
        }
        private string _IsFenPeiS;
        [DataMember]
        public string IsFenPeiS
        {
            get { return _IsFenPeiS; }
            set { _IsFenPeiS = value; }
        }
        public static BianZhiJieYongModel FillEntity(DataRow dr)
        {
            BianZhiJieYongModel right = new BianZhiJieYongModel();
            if (dr.Table != null && dr.Table.Columns.Contains("IsFenPei"))
                if (!string.IsNullOrEmpty(dr["IsFenPei"].ToString())) right.IsFenPei = Convert.ToBoolean(dr["IsFenPei"]);
            if (right.IsFenPei == true)
            {
                right.IsFenPeiS = "是";
            }
            else right.IsFenPeiS = "否";
            if (dr.Table != null && dr.Table.Columns.Contains("ID") && !string.IsNullOrEmpty(dr["ID"].ToString())) right.ID = (int)dr["ID"];
            if (dr.Table != null && dr.Table.Columns.Contains("BianZhiID") && !string.IsNullOrEmpty(dr["BianZhiID"].ToString()))
                right.BianZhiID = (int)dr["BianZhiID"];
            if (dr.Table != null && dr.Table.Columns.Contains("JieYongID")) right.JieYongID = dr["JieYongID"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("JieYongQingKuang")) right.JieYongQingKuang = dr["JieYongQingKuang"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("JieYongType")) right.JieYongType = dr["JieYongType"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("BianZhiGUID")) right.BianZhiGUID = dr["BianZhiGUID"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("IsZhengKeTongKeShiJieYong")) 
                if (!string.IsNullOrEmpty(dr["IsZhengKeTongKeShiJieYong"].ToString())) right.IsZhengKeTongKeShiJieYong = Convert.ToBoolean(dr["IsZhengKeTongKeShiJieYong"]);
            if (right.IsZhengKeTongKeShiJieYong == true)
            {
                right.IsZhengKeTongKeShiJieYongS = "是";
            }
            else right.IsZhengKeTongKeShiJieYongS = "否";
            if (dr.Table != null && dr.Table.Columns.Contains("GuoDuZhiShu")) right.GuoDuZhiShu = dr["GuoDuZhiShu"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("IsGuoDuXing")) if (!string.IsNullOrEmpty(dr["IsGuoDuXing"].ToString())) right.IsGuoDuXing = Convert.ToBoolean(dr["IsGuoDuXing"]);
            return right;
            
        }
    }
}
